#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    float a = 0;
    int  b, c, d;
    scanf("%f %d %d %d", &a, &b, &c, &d);
    if ((b == 11 && c == 11) || (b == 12 && c == 12))
    {
        if (b == 11)
        {
            if (d == 0)
            {
                a = a * (0.7);
            }
            else
            {
                a = a * (0.7) - 50;
            }
        }
        else
        {
            if (d == 0)
            {
                a = a * (0.8);
            }
            else
            {
                a = a * (0.8) - 50;
            }
        }
    }
    if (a < 0)
    {
        a = 0.00;
    }
    printf("%.2f", a);
    return 0;
}